package com.jobsika.client.login;

import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.HTMLTable.RowFormatter;

public class Login extends Composite {
	private AbsolutePanel skeleton;
	private FlexTable panel;
	private PasswordTextBox password;
	private Label loginLabel;
	private Anchor signInLink;
	
	public Login() {
		skeleton = new AbsolutePanel();
		panel = new FlexTable();
		password = new PasswordTextBox();
		loginLabel = new Label(
			"Please sign in to your Google Account to access Jobsika.");
		signInLink = new Anchor("Sign In");
		RowFormatter rowfmt = panel.getRowFormatter();
		int row = 0;
		FlexCellFormatter fxcellfmt = panel.getFlexCellFormatter();
		fxcellfmt.setColSpan(0, 0, 2);
		
		panel.setCellSpacing(0);
		panel.setCellPadding(0);
//		panel.setHTML(row++, 0, "Login:");
		row++;
		panel.setHTML(row, 0, "Username");
		panel.setWidget(row++, 1, new TextBox());
		panel.setHTML(row, 0, "Password");
		panel.setWidget(row++, 1, password);
		fxcellfmt.setColSpan(row, 0, 2);
		panel.setWidget(row++, 0, loginLabel);
		fxcellfmt.setColSpan(row, 0, 2);
		panel.setWidget(row++, 0, signInLink);
		
		skeleton.setStyleName("login");
		rowfmt.setStyleName(0, "login-header");
		panel.setStyleName("login-panel");
		
		skeleton.add(panel);
		this.initWidget(skeleton);
	}
	
	public void setSignInLink(String href) {
		signInLink.setHref(href);
	}

}
